package com.mybatisx.mybatisplus.controller;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.conditions.query.QueryChainWrapper;
import com.mybatisx.mybatisplus.entity.User;
import com.mybatisx.mybatisplus.exception.ExceptionCast;
import com.mybatisx.mybatisplus.model.response.*;
import com.mybatisx.mybatisplus.service.UserService;
import org.checkerframework.checker.units.qual.A;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author lyh
 * @since 2021-06-22
 */
@RestController
@RequestMapping("/mybatisplus/user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping("/findUser")
    public QueryResponseResult findUser(){
        try {
            BaseMapper<User> baseMapper = userService.getBaseMapper();
            return   new QueryResponseResult(CommonCode.SUCCESS,new QueryResult());
        } catch (Exception e) {
             ExceptionCast.cast(CoustomCode.ERROE);  //返回提示信息
        }
        return new QueryResponseResult(CommonCode.FAIL,null);
    }
}

